# Filters added to this controller apply to all controllers in the application.
# Likewise, all the methods added will be available for all controllers.

class ApplicationController < ActionController::Base
  helper :all # include all helpers, all the time
  before_filter :require_login, :except => [:login, :logout, :fetch, :rush, :about, :umoc, :reset, :reset_password, :password]
  
  cache_sweeper :members_sweeper, :only => [:save, :destroy]
  cache_sweeper :events_sweeper, :only => [:update, :destroy, :driver_true, :driver_false, :add_attendee, :update_attendees, :remove, :undelete, :mic_signup, :mic_remove, :un_approve_event, :approve_event, :add_current_user, :remove_attendee, :submit_attendee_hours, :do_replace]
  cache_sweeper :announcements_sweeper, :only => [:save, :destroy, :post_admin, :post_member, :delete_post]

  # See ActionController::RequestForgeryProtection for details
  # Uncomment the :secret if you're not using the cookie session store
  protect_from_forgery # :secret => '5c90186db8ed143d9d41a49e31c0e452'

  filter_parameter_logging :password, :password_confirmation

  def require_login
    if session[:user].nil?
      redirect_to :controller => "apo", :action => "login"
    end
  end

end
